<?php include_component('gallery', 'path') ?><br />

	<?php if( !empty($arBranch) ): ?>
		<div id="" class="conkelias">		
			<?php foreach($arBranch as $tree): ?>

					<?php if( $tree['obj']->getChildrenQnt() ): ?>
						<?php foreach($tree['children'] as $child): ?>

									<?php echo link_to($child['obj']->getName(), 'gallery/show?id=' . $child['obj']->getObjId()) ?><br />

						<?php endforeach; ?>
					<?php endif; ?>

			<?php endforeach; ?>
		</div>
	<?php endif; ?>

<?php if( isset($page) ): ?>

	<div class="contitle"><?php echo $page->getName()?></div>

	

	<?php echo $page->getText(); ?>

	<?php foreach( $pager->getResults() as $photo ): ?>
		<?php 
			$file = sfConfig::get('sf_web_dir') . '/images/gallery/medium/' . $photo->getUname();
			$arInfo = getimagesize($file);
		?>
		<?php /* echo link_to(image_tag('gallery/tiny/' . $photo->getUname(), array(
			'border' => 0
			,'alt' => $photo->getName()
			,'title' => $photo->getName()
		)), '#', array(
			'onClick' => 'window.open("/images/gallery/medium/' . $photo->getUname() . '","popupWindow","width=' . $arInfo[0] . ',height=' . $arInfo[1] . ',left=320,top=0");return false;'
		));*/
			echo link_to(
				image_tag('gallery/tiny/' . $photo->getUname(), array(
					'border' => 0
					,'alt' => $photo->getName()
					,'title' => $photo->getName()
				)), 'gallery/image?id=' . $photo->getId()
// Popup linkas
                , array(
                    'popup' => array('usladushka', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=' . ($arInfo[0] + 6) . ',height=' . ($arInfo[1] + 6) . ',left=200,top=50')
                )
            )
		
		?>&nbsp;&nbsp;
	<?php endforeach; ?>


	<br /><br />
<?php if ($pager->haveToPaginate()): ?>
    <div class="paging">
        <div class="paging_link">
            <?php echo link_to(
                    '&laquo;'
                    , 'gallery/show?id=' . $page->getId() . '&page='.$pager->getFirstPage()
                ) ?>
        </div>
        <div class="paging_link">
             <?php echo link_to(
                    '&lsaquo;'
                    , 'gallery/show?id=' . $page->getId() . '&page='.$pager->getPreviousPage()
                ) ?>
        </div>
            <?php $links = $pager->getLinks(); foreach ($links as $page): ?>
            <?php echo ($page == $pager->getPage()) ? '<div class="paging_current">' . $page . '</div>' : '<div class="paging_link">' . link_to($page, 'gallery/show?id=' . $page->getId() . '&page='.$page) . '</div>' ?>
            <?php if ($page != $pager->getCurrentMaxLink()): ?>
            <?php endif; ?>
            <?php endforeach; ?>
        <div class="paging_link">
            <?php echo link_to(
                        '&rsaquo;'
                        , 'gallery/show?id=' . $page->getId() . '&page='.$pager->getNextPage()
                    ) ?>
        </div>
        <div class="paging_link">
            <?php echo link_to(
                        '&raquo;'
                        , 'gallery/show?id=' . $page->getId() . '&page='.$pager->getLastPage()
                    ) ?>
        </div>
    </div>
<?php endif ?>

<?php else: ?>
		<?php echo __('no gallery') ?>

<?php endif; ?>
